package com.Socket.Server;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class JudgeOfTable {
    public static boolean Judge(User user){
        boolean flag = false;
        Connection connect = Dbutils.Connect();
        String sql = "select * from userinformation where userName ='"+user.getUsername()+"' and password = '"+user.getPassword()+"'";
        PreparedStatement pstmt = Dbutils.getPrepareStatement(connect, sql);
        ResultSet resultSet = null;
        try {
            resultSet = pstmt.executeQuery();
            if((resultSet.next())){
                flag = true;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return flag;
    }
}
